package com.carleasoft.mps.forum.business.answer.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.carleasoft.mps.core.result.R;
import com.carleasoft.mps.forum.business.answer.bean.ForumData;
import com.carleasoft.mps.forum.business.answer.bean.ForumUserPermission;
import com.carleasoft.mps.forum.business.answer.bean.po.ForumDataPo;
import com.carleasoft.mps.forum.business.answer.bean.po.ForumUserPo;
import com.carleasoft.mps.forum.business.answer.service.ForumUserPermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zang
 * @since 2023-05-09
 */
@RestController
@RequestMapping("/forumUserPermission")
public class ForumUserPermissionController {

    @Autowired
    private ForumUserPermissionService forumUserPermissionService;

    /**
     * @author zang
     * @desc 分页查询用户行为
     * @date 2023-05-19
     */
    @PostMapping("/pageForumUser")
    public R pageForumUser(@RequestBody ForumUserPo forumUserPo) {
        Page page = new Page(forumUserPo.getCurrent(), forumUserPo.getSize());
        Page<ForumUserPermission> res = forumUserPermissionService.pageForumUser(page,forumUserPo);
        return R.ok(res);
    }

    /**
     * @author zang
     * @desc 编辑用户状态
     * @date 2023-05-19
     */
    @PostMapping("/updateForumStatus")
    public R updateForumStatus(@RequestBody ForumUserPermission forumUserPermission) {
        forumUserPermissionService.updateForumStatus(forumUserPermission);
        return R.ok();
    }
    /**
     * @author zang
     * @desc 编辑用户昵称和头像信息
     * @date 2023-05-19
     */
    @PostMapping("/updateForumInfo")
    public R updateForumInfo(@RequestBody ForumUserPermission forumUserPermission) {
        forumUserPermissionService.updateForumInfo(forumUserPermission);
        return R.ok();
    }

}

